﻿@using System.Collections.Generic
@using JuCheap.Core.Models
@using JuCheap.Core.Models.Enum
@using JuCheap.Core.Infrastructure.Extentions
@{
    List<MenuDto> menus = ViewBag.Menus;
}

<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="nav-close">
        <i class="fa fa-times-circle"></i>
    </div>
    <div class="sidebar-collapse">
        <div align="left">
            <img src="~/img/menu_logo.png" />
        </div>
        <ul class="nav" id="side-menu">
            @*<li class="nav-header">
                
                <div class="logo-element">
                    Ju3
                </div>
            </li>*@
            @if (menus != null)
            {
                foreach (var module in menus.OrderBy(x => x.Order).Where(item => item.Type == MenuType.Module))
                {
                    <li>
                        <a href="#">
                            <i class="@(module.Icon.IsBlank() ? "fa fa-tv" : module.Icon)"></i>
                            <span class="nav-label">@module.Name</span>
                            <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            @foreach (var menu in menus.OrderBy(x => x.Order).Where(item => item.ParentId == module.Id))
                            {
                                <li>                                    
                                    <a class="J_menuItem" href="@menu.Url" data-index="@module.Id">
                                        <i class="@(menu.Icon.IsBlank() ? "fa fa-angle-right" : menu.Icon)"></i>
                                        @menu.Name
                                    </a>
                                </li>
                            }
                        </ul>

                    </li>
                }
            }
        </ul>
    </div>
   
</nav>
